*Figure 1: distribution of milcas var
hist deathlog

*Table 1: Operationalization of main vars
sum dmilscale
sum deathlog
sum dseatshare
sum wardeaths
tab inoff
tab parfam3
tab post911

*Figure 2: Boxplot of party family
graph box milscale if parfam!=90, over(parfam)

*Table 2 - Model 1 : no interaction
xtgls dmilscale c.deathlog##i.inoff i.parfam3 post911 wardeaths dseatshare, c(psar1) panels(h) force
*margins used to create figure 3
margins, dydx(inoff) at(deathlog=(0(1)8) parfam3=(0(1)2)) post
*Table2 - Model 2: Threeway interaction: in office /w parfam
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 post911 wardeaths dseatshare, c(psar1) panels(h) force
*margins used to create figure 3
margins, dydx(deathlog) at(inoff=(0(1)1) parfam3=(0(1)2)) post



*ROBUSTNESS CHECKS*

*Table 4 - Model 3: EXCL US twoway interaction
xtgls dmilscale i.inoff##c.deathlog i.parfam3 post911 wardeaths dseatshare if countryn!=61, c(psar1) panels(h) force
*margins used for figure 1
margins, dydx(inoff) at(deathlog=(0(1)8)) post
*Table 4 - Model 4: EXCL US Threeway interaction: in office /w parfam
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 post911 wardeaths dseatshare if countryn!=61, c(psar1) panels(h) force
*margins used for figure 1
margins, dydx(deathlog) at(inoff=(0(1)1) parfam3=(0(1)2)) post


*Table 5 - Model 5: BEFORE 911 - 2way
xtgls dmilscale c.deathlog##i.inoff i.parfam3 wardeaths dseatshare if post911==0, c(psar1) panels(h) force
*Table 5 - Model 6: BEFORE 911 - Threeway interaction: in office /w parfam
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 wardeaths dseatshare if post911==0, c(psar1) panels(h) force

*Table 6 -  model 7: AFTER 911 - 2way
xtgls dmilscale c.deathlog##i.inoff i.parfam3 wardeaths dseatshare if post911==1, c(psar1) panels(h) force
*Table 6 -  model 8:  AFTER 911 - Threeway interaction: in office /w parfam
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 wardeaths dseatshare if post911==1, c(psar1) panels(h) force

*Table 7 - Model 9: ABSOLUTE NUMBERS - 2way
xtgls dmilscale i.inoff##c.deaths_elec i.parfam3 post911 sum_genocide_battle_deaths dseatshare, c(psar1) panels(h) force
margins, dydx(inoff) at(deaths_elec=(0(250)3356)) post
*Model 7 - model 10: ABSOLUTE NUMBERS - Threeway interaction: in office /w parfam
xtgls dmilscale c.deaths_elec##i.inoff##i.parfam3 post911 sum_genocide_battle_deaths dseatshare, c(psar1) panels(h) force
margins, dydx(deaths_elec) at(inoff=(0(1)1) parfam3=(0(1)2)) post

*Table 8 - model 11: control for majority government
xtgls dmilscale c.deathlog##i.inoff i.parfam3 wardeaths majority, c(psar1) panels(h) force

*Table 9 - model 12: CONTROL POPULARITY - 2way
xtgls dmilscale c.deathlog##i.inoff i.parfam3 wardeaths dseatshare popularity, c(psar1) panels(h) force
*Table 9 -  model 13:  CONTROL POPULARITY - Threeway interaction: in office /w parfam 
xtgls dmilscale c.deathlog##i.inoff##i.parfam3 wardeaths dseatshare popularity, c(psar1) panels(h) force

*Table 11 -  model4
*Threeway interaction: in office /w rile
xtgls dmilscale c.deathlog##i.inoff##c.rile post911 wardeaths dseatshare, c(psar1) panels(h) force
margins, dydx(deathlog) at(inoff=(0(1)1) rile=(-20(10)20)) post
